/**
 * 转发端点类
 * 在需要以端点作为std::map的key的时候使用
 */
#ifndef __FORWARD_ENDPOINT_H_INCLUDED__
#define __FORWARD_ENDPOINT_H_INCLUDED__

#ifdef __cplusplus
extern "C" {
#endif

#include <netinet/in.h>
#include <unistd.h>

class forward_endpoint{

public:

	forward_endpoint(){
	}

	forward_endpoint(sockaddr_in& si){
		this->si = si;
	}

	~forward_endpoint(){
	}

	bool operator<(const forward_endpoint& g)const{

		bool ret = false;
		if (si.sin_addr.s_addr < g.si.sin_addr.s_addr){
			ret = true;
		}else if (si.sin_addr.s_addr == g.si.sin_addr.s_addr){
			if (si.sin_port < g.si.sin_port){
				ret = true;
			}
		}
		return ret;
	}

public:

	sockaddr_in si;
};

#ifdef __cplusplus
}
#endif

#endif // __FORWARD_ENDPOINT_H_INCLUDED__
